// Number_Commander ACW
// Joe Pardue May 11, 2009

#include "libACW001.h"

void cmdParse(void);
void cmd0(void);
void cmd1(void);
void cmd2(void);
void cmd3(void);
void cmd4(void);

int cmd = 0;

int main(void)
{
	init();

	setup();
    
	for (;;)
		loop();
        
	return 0;
}

void setup()
{
  //Serial.begin(9600);
  serialBegin(9600); 
}

void loop()
{
  // check if data has been sent from the computer
  //if (Serial.available()) {
  if(serialAvailable()){
    cmdParse();
  }
}

void cmdParse()
{
  //cmd = Serial.read();
  cmd = serialRead();

  switch(cmd)
  {
    case '0':
      cmd0();
      break;
    case '1':
      cmd1();
      break; 
    case '2':
      cmd2();
      break;  
    case '3':
      cmd3();
      break;       
    case '4':
      cmd4();
      break; 
    default:
      //Serial.print("TAW Invalid number command: ");
      //Serial.println(cmd, BYTE);
	  printf("ACW Invalid number command: %c\n",cmd);
      break;
  } 
}
 
void cmd0()
{
  //Serial.println("TAW cmd0");
  printf("ACW cmd0\n");
}

void cmd1()
{
  //Serial.println("TAW cmd1");
  printf("ACW cmd1\n");
}

void cmd2()
{
  //Serial.println("TAW cmd2");
  printf("ACW cmd2\n");
}

void cmd3()
{
  //Serial.println("TAW cmd3");
  printf("ACW cmd3\n");
}

void cmd4()
{
  //Serial.println("TAW cmd4");
  printf("ACW cmd4\n");
}
